package com.cqgc.mapper;

import com.cqgc.pojo.dto.GoodsDTO.GoodsPageQueryDTO;
import com.cqgc.pojo.dto.GoodsDTO.LikeGoods;
import com.cqgc.pojo.entity.Goods;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : 是你
 * @time : 2024/4/16 23:22
 */
@Mapper
public interface GoodsMapper {
    @Select("select * from goods")
    Page<Goods> list(GoodsPageQueryDTO goodsPageQueryDTO);

    @Delete("delete from goods where gid = #{gid}")
    int delete(int gid);


    List<Goods> detail(int account);

    int add(Goods addGoodsDTO);

//    @Select("select * from goods where category_id = #{categoryId}")
    List<Goods> findByCategoryId(int categoryId);

    List<Goods> like(LikeGoods likeGoods);

    int findRoleByUid(int uid);

    /**
     * 根据id查询商品
     * @param gid
     * @return
     */
    @Select("select * from goods where gid = #{gid}")
    Goods findById(int gid);

    @Select("select * from goods")
    List<Goods> findAll();

    int update(Goods updateGoodsDTO);

}
